package com.chub.study.exception;

import com.chub.RespEnum;
import lombok.Data;

/**
 * @author : chub
 * @version : V1.0.0
 * @fileName : StudyException.java
 * @description : 自定义全局异常类
 * @createTime : 2022-04-23 10:31
 */
@Data
public class StudyException extends RuntimeException {
    private RespEnum respEnum;

    public StudyException(RespEnum respEnum, String message) {
        super(message);
        this.respEnum = respEnum;
    }

    public StudyException(RespEnum respEnum) {
        super(respEnum.getMessage());
        this.respEnum = respEnum;
    }

    @Override
    public String toString() {
        return "StudyException{" + "code=" + respEnum.getCode() + ", message=" + this.getMessage() + '}';
    }
}
